import React from 'react'
import { Link } from 'react-router-dom'
import { JumboTabs, Empty } from 'antd-mobile'
import { imgPre } from '../../../../request/http'
import './Seckill.less'
import addcart from '../../../../assets/img/addcart.png'//图标

export default function Seckill(props) {
  // 1.取数据
  let { seckill, timeArr } = props;
  return (
    <div className='seckill'>
      <div className='title'>
        <p>秒杀</p>
        {/* 2.倒计时 */}
        <span>
          <i>{timeArr.h}</i>:<i>{timeArr.m}</i>:<i>{timeArr.s}</i>
        </span>
      </div>
      {/* 3.商品展示 */}
      <div className='wrap'>
        <JumboTabs>
          {seckill.length > 0 ? <>
            {seckill.map(item => {
              return <JumboTabs.Tab key={item.id} title={
                <Link to={"/detail/1/" + item.id}>
                  <div className='con'>
                    <img src={imgPre + item.img} alt="" />
                    <div className='foot'>
                      <div className='left'>
                        <p>￥{item.price}</p>
                        <span><img src={addcart} alt="" /></span>
                      </div>
                      <div className='right'>
                        <>{item.goodsname}</>
                      </div>
                    </div>
                  </div>
                </Link>
              } />
            })}
          </> : <Empty description='暂无数据' />}
        </JumboTabs>
      </div>
    </div>
  )
}
